package com.weibo.util;

import java.util.HashMap;
import java.util.Map.Entry;

public class ProvinceUtil {

	//String 为“编号,城市/省份”
	private static HashMap<String, HashMap<String, String>> provinces = new HashMap<String, HashMap<String, String>>();
	
	public static void setProvinces(){
		HashMap<String, String> anhui = new HashMap<String, String>();
		anhui.put("1", "合肥");anhui.put("2", "芜湖");anhui.put("3", "蚌埠");
		anhui.put("4", "淮南");anhui.put("5", "马鞍山");anhui.put("6", "淮北");
		anhui.put("7", "铜陵");anhui.put("8", "安庆");anhui.put("10", "黄山");
		anhui.put("11", "滁州");anhui.put("12", "阜阳");anhui.put("13", "宿州");
		anhui.put("14", "巢湖");anhui.put("15", "六安");anhui.put("16", "亳州");
		anhui.put("17", "池州");anhui.put("18", "宣城");
		provinces.put("34,安徽", anhui);
		HashMap<String, String> hunan = new HashMap<String, String>();
		hunan.put("1", "长沙");hunan.put("2", "株洲");hunan.put("4", "衡阳");
		hunan.put("3", "湘潭");hunan.put("5", "邵阳");hunan.put("6", "岳阳");
		hunan.put("7", "常德");hunan.put("8", "张家界");hunan.put("9", "益阳");
		hunan.put("10", "郴州");hunan.put("11", "永州");hunan.put("12", "怀化");
		hunan.put("13", "娄底");hunan.put("31", "湘西土家族苗族自治州");
		provinces.put("43,湖南", hunan);
	}
	
	public static String getProvince(int provice,int city){
		String result = "";
		for(Entry<String, HashMap<String, String>> province1 : provinces.entrySet()){
			String[] args = province1.getKey().split(",");
			if(args!=null&&args.length==2&&args[0].equals(String.valueOf(provice))){
				result+=args[1]+","+province1.getValue().get(String.valueOf(city));
				break;
			}
		}
		return result;
	}
}
